<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>限时抢购</title>
<link type="text/css" href="css/reset.css" rel="stylesheet" />
<link type="text/css" href="css/public.css" rel="stylesheet" />
<link type="text/css" href="css/style.css" rel="stylesheet" />
<link type="text/css" href="css/wode.css" rel="stylesheet" />
<style>
  *{margin:0;padding:0;}
  body{text-align:center;}
  .text{margin-top:150px;font-size:14px;}
  </style>
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>

 <script src="js/jquery.min.js?v=2.1.4"></script>
 <script src="js/core.js"></script>
<script src="js/4.0.0xianshiqianggou.js"></script>
</head>
<body>
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <input type="hidden" id="shijian"/>
        <input type="hidden" id="fuzhuang"/>
        
        <h1>
        	<ul class="jg_header clearfix">
        		<li  class="jg_curr" name="leibie" id="1" onclick="dianjiss(this)">服装</li>
        		<li class="" id="2" name="leibie" onclick="dianjiss(this)">皮靴</li>
        		<li class="" id="3" name="leibie" onclick="dianjiss(this)">箱包</li>
        	</ul>
        </h1>
    </header>
</div>
<input type="text" id="tuijians" value="1"/>
<!--品牌大本营-->
<div class="a_bank_order">
    <!--头部-->
    <ul id="qianggouid" class="a_time clearfix">
        <li class="active" id="1">
            <a  onclick="selectGoods(1)" id="1">
                <span>今日抢批</span>
            </a>
        </li>
        <li id="2">
            <a  onclick="selectGoods(2)" >
                <span>明日预告</span>
            </a>
        </li>
    </ul>
    <div class="m_ddcon">
    	<!--今日抢批，倒计时-->
        <div class="miaosha_time mid-width" id="shengyushijian">  
            <ul class="clearfix ">
                <li class="a_last_time">
                    <em class="fl">剩余时间</em>
                    <div class="a_time_num">
                        <div class="colockbox" id="demo01" style="width:100px;">
                            <span class="hour" id="shi"></span>
                            <span class="minute" id="fen"></span>
                            <span class="second" id="miao"></span>
                        </div>
                    </div>
                </li>
                <li class="fr">每天十点准时更新</li>
            </ul>
        </div>
        <!--商品-->
        <div class="jg_xianshi" id="shangpingids">
        </div>
         <div class="jg_xianshi" id="shangpingids2">
        </div>
    </div>
   
</div>

<!--订单显示-->
<!--<div id="qiangdan"></div>-->

<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
  <script>
    window.onload=function(){      
      getMyTime(); 
      //getMyTime1();  
    }
    //1.前面补0
    function p(n){
      return n<10?'0'+n:n;
    }
    //2.倒计时
    function getMyTime(){
      var startDate=new Date();
      var a=$("#shijian").val();
      if(a==""){
      	a="2017-10-12 10:10:10";
      }
      
        a=a.replace(/-/g,':').replace(' ',':');
     a=a.split(':');
var time1 = new Date(a[0],(a[1]-1),a[2],a[3],a[4],a[5]);
      //var endDate=new Date(a);
      var countDown=(time1.getTime()-startDate.getTime())/1000;
      var day=parseInt(countDown/(24*60*60));
      var h=parseInt(countDown/(60*60)%24);
      var m=parseInt(countDown/60%60);
      var s=parseInt(countDown%60);        
      document.getElementById('shi').innerHTML=p(h);
    
      document.getElementById('fen').innerHTML=p(m);
      document.getElementById('miao').innerHTML=p(s);
      setTimeout('getMyTime()',500);
      if(countDown<=0){
      document.getElementById('shi').innerHTML=p(0);
      document.getElementById('fen').innerHTML=p(0);
      document.getElementById('miao').innerHTML=p(0);
      }       
    }
  
  </script>	

<script type="text/javascript">
    $(function(){
        // tab切换
        $(function () {
           $('.a_time li').on('click',function(){
                //获得当前被点击的元素索引值
                var Index = $(this).index();
                //给菜单添加选择样式
                $(this).addClass('active').siblings().removeClass('active');
                //显示对应的div
                $('.a_bank_order').children('div').eq(Index).show().siblings('div').hide();
           
           });
        });
    });
    

    $(function(){
        countDown("2017/8/16 22:59:59",null,"#demo01 .hour","#demo01 .minute","#demo01 .second");
        countDown("2017/8/16 22:59:59",null,"#demo02 .hour","#demo02 .minute","#demo02 .second");
        countDown("2017/8/16 22:59:59",null,"#demo03 .hour","#demo03 .minute","#demo03 .second");
    });
    function countDown(time,day_elem,hour_elem,minute_elem,second_elem){
        //if(typeof end_time == "string")
        var end_time = new Date(time).getTime(),//月份是实际月份-1
        //current_time = new Date().getTime(),
        sys_second = (end_time-new Date().getTime())/1000;
        var timer = setInterval(function(){
            if (sys_second > 0) {
                sys_second -= 1;
                var day = Math.floor((sys_second / 3600) / 24);
                var hour = Math.floor((sys_second / 3600) % 24);
                var minute = Math.floor((sys_second / 60) % 60);
                var second = Math.floor(sys_second % 60);
                day_elem && $(day_elem).text(day);//计算天
                $(hour_elem).text(hour<10?"0"+hour:hour);//计算小时
                $(minute_elem).text(minute<10?"0"+minute:minute);//计算分
                $(second_elem).text(second<10?"0"+second:second);// 计算秒
            } else { 
                clearInterval(timer);
            }
        }, 1000);
    }
</script>
<script>
	  function dianjiss(te){
	  	  var obj_lis =$("#qianggouid").find("li");
	  	  var ids="";
	  	  obj_lis.each(function(){
	  	  	 if($(this).attr("class")=="active"){
	  	  	 	  ids=$(this).attr("id");
	  	  	 	 // alert(ids);
	  	  	 }
	  	  });
	  	
	  	// var tes=$(te).attr("class","jg_curr");
	  	 var tesid=$(te).attr("id");
	  	 $('[name="leibie"]').each(function(){
	  	 	   if($(this).attr("id")==tesid){
	  	 	   	    $(this).attr("class","jg_curr");
	  	 	   	    if(ids==1){
	  	 	   	    	//alert(tesid);
	  	 	   	    	jingr(1,tesid);
	  	 	   	    }else if(ids==2){
	  	 	   	    	jingr(2,tesid);
	  	 	   	    }
	  	 	   }else{
	  	 	   	   $(this).attr("class","");
	  	 	   }
	  	 });
	  	  
	  }
</script>
   
<script>
	function selectGoods(tui){
		 if(tui==1){
		 		ss=0;
		ss2=0;
		currentPage=1;
		currentPage2=1;
		$("#shangpingids").html("");
		$("#shangpingids2").html("");
	          xianshu();
	          }else if(tui==2){
	          		ss=0;
		ss2=0;
		currentPage=1;
		currentPage2=1;
		$("#shangpingids").html("");
		$("#shangpingids2").html("");
	          	selectjingr();
	          }
		$("#tuijians").val(tui);
		
	}
		 $(window).scroll(function() {
    if ($(document).scrollTop() >= $(document).height() - $(window).height()) {
	          var tui=$("#tuijians").val();
	          if(tui==1){
               currentPage++
	          xianshu();
	          }else if(tui==2){
	          	currentPage2++
	          	selectjingr();
	          }
	        
       }
  });	
	
</script>

</body>
</html>